package com.qn.chain;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * 身份验证链接
 *
 * @author Qning
 * @date 2021/09/10
 */
public abstract class AuthLink {

    /**
     * 时间格式化
     */
    protected SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    /**
     * 级别人员ID
     */
    protected String levelUserId;
    /**
     * 级别人员姓名
     */
    protected String levelUserName;
    /**
     * 责任链
     */
    private AuthLink next;

    public AuthLink(String levelUserId, String levelUserName) {
        this.levelUserId = levelUserId;
        this.levelUserName = levelUserName;
    }

    public AuthLink next() {
        return next;
    }

    public AuthLink appendNext(AuthLink next) {
        this.next = next;
        return this;
    }

    /**
     * 处理审核
     *
     * @param uId      你的id
     * @param orderId  订单id
     * @param authDate 认证日期
     * @return {@link AuthInfo}
     */
    public abstract AuthInfo doAuth(String uId, String orderId, Date authDate);

}